//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2009 Manu Mital mital.manu@gmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#pragma once
#include "afxcmn.h"
#include "afxwin.h"


// CCreateReadingPlan dialog

class CCreateReadingPlan : public CDialog
{
	DECLARE_DYNAMIC(CCreateReadingPlan)

public:
	CCreateReadingPlan(CWnd* pParent = NULL);   // standard constructor
	virtual ~CCreateReadingPlan();

// Dialog Data
	enum { IDD = IDD_DIALOG_ADDRP };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
	void PopulateTree();
	void OnCheckStateChange();

	void GetNumDays();   // number of days in the plan stored in variable planDays
	void GetPlanName();  // plan name stored in variable newPlanName
	void GetNumVerses(); // number of verses stored in variable numPlanVerses
	void AssignReadings(); // assign verses to read for each day of the plan
	void AddBook(int book);   // helper function - add a selected book to daily readings
	void AddChapter(int book, int chapter);  // helper function - add a selected chapter of a book to daily readings

	CImageList m_image; // member variable to hold the image list
	CTreeCtrl treeCtrl;
	static CString newPlanName;
	int planDays;
	int numPlanVerses;
	int versesPerDay;
	CUIntArray selectedBooks;
	
	CEdit PlanNameEdit;
	int oneMonth;      // radio button variable
	static CStringArray dateArray;             // an array containing the reading dates
	static CStringArray DailyReadingsArray;        // an array containing the daily readings
	CUIntArray NumEmpty;							// a helper to keep track of which days of daily readings have already
	                                              // been filled with verses
	int NumEmptyIdx;

	void AddVerseRange(int index, int Book, int Chapter,
		int StartVerse, int EndVerse);


	afx_msg void OnSelTree(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMClickTreeReadingplan(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTvnKeydownTreeReadingplan(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg LRESULT OnCheckStateChange(WPARAM wp, LPARAM lp);
	afx_msg void OnOk();




};
